<include file="../Public/header" />
<link href="{:APPS_URL}/w3g/_static/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
  body{background-color: #f8f8f8;}
</style>
<div id="content">
    <div id="weiba" data-title="修改密码" class="panel" data-selected="true"  data-menu="msgmenu" style="padding:0;">
        <header>
            <div id="header-buttons">
                <a href="javascript:history.go(-1);">
                    <div id="back" class="header-menu-link" data-back="false">
                    </div>
                </a>
            </div>
            <h1 class="hasback">
                修改密码
            </h1>
        </header>
    <div class="set-item" id="">
        <form id="doModifyPassword" method="post">
         <div class="form-set">
            <dl>
                <dd><input id="oldpassword" name="oldpassword" type="password" class="text1" autocomplete = 'off' placeholder="原始密码"/></dd>
            </dl>
            <dl>
                <dd><input id="password" name="password" type="password" class="text1" placeholder="新密码"/></dd>
            </dl>
            <dl class="noborder">
                <dd><input id="repassword" name="repassword" type="password" class="text1" placeholder="确认密码"/></dd>
            </dl>
         </div>
         </form>
         <div class="setBtn"><a href="javascript:;" class="btn-big" onclick="setNewPass()">保存</a></div>
    </div>
</div>
<script type="text/javascript">
function setNewPass(){
  if($('#oldpassword').val() == ''){
    $.ui.showMask("请输入旧密码",true);
     return false;
  }
  if($('#password').val() == ''){
    $.ui.showMask("请输入新密码",true);
     return false;
  }
  if($('#repassword').val() == ''){
    $.ui.showMask("请输入重复密码",true);
     return false;
  }
  if($("#password").val() != $('#repassword').val()){
     $.ui.showMask("新密码和重复密码不一致",true);
     return false;
  }
  $.ajax({
    type : 'post',
    url : U('public/Account/doModifyPassword'),
    data: $('#doModifyPassword').serialize(),
    timeout : 10000,
    dataType: 'json',
    success : function(d){
        if(d && d.status){
            $.ui.showMask(d.info,true);
            location.href=U('w3g/Setting/security');
        }
        else{
            $.ui.showMask(d.info,true);
        }
    },
    error: function(r){
        $.ui.showMask("连接服务器失败，请重试:)",true);
    }
  });
}

</script>
<include file="../Public/footer" />